
add_requires("local_jni" , {configs = {java_home=get_config("JAVA_HOME")}})

target("ar8030_java")
    set_kind('shared')
    add_rules("swig.c", {moduletype = "java"})
    add_files("ar8030.i", {scriptdir = "java"})
    add_deps("ar8030_client")
    add_includedirs("./")
    add_packages("local_jni")

    on_install(function (target)
        javapath = path.join(target:installdir() , "java")
        os.mkdir(javapath)

        os.cp(target:targetfile() , javapath)
        -- print(target:data( "swig.scriptfiles"))
        for _,genfile in pairs(target:data("swig.scriptfiles")) do 
            os.cp(genfile , javapath)
        end
    end)

target("callback_java")
    set_kind('shared')
    add_rules("swig.cpp", {moduletype = "java"})
    add_files("callback.i", {scriptdir = "java"})
    add_deps("ar8030_client")
    add_includedirs("./")
    add_packages("local_jni")

    on_install(function (target)
        javapath = path.join(target:installdir() , "java")
        os.mkdir(javapath)

        os.cp(target:targetfile() , javapath)
        -- print(target:data("swig.scriptfiles"))
        for _,genfile in pairs(target:data("swig.scriptfiles")) do 
            os.cp(genfile , javapath)
        end
    end)